package com.share.function.bean;

public class PageBean {
	// 数据总行数
	private int count;
	// 页数
	private int page;
	// 每页行数
	private int row = 10;
	private String order="sIp";
	private String desc="desc";

	public int getCount() {
		return count;
	}

	public void setCount(int count) {
		this.count = count;
	}

	public int getPage() {
		if (page <= 0) {
			return 1;
		}
		return page;
	}

	public void setPage(String page) {
		try {
			this.page = Integer.parseInt(page);
		} catch (Exception e) {
			this.page = 1;
		}
	}

	public int getRow() {
		return row;
	}

	public void setRow(int row) {
		this.row = row;
	}

	/**
	 * 得到总页数
	 * 
	 * @return
	 */
	public int getPages() {
		if (count <= 0) {
			return 1;
		}
		return count % row == 0 ? count / row : count / row + 1;
	}

	/**
	 * 得到开始行
	 * 
	 * @return
	 */
	public int getBeginRow() {
		return (getPage() - 1) * row;
	}

	public String getOrder() {
		return order;
	}

	public void setOrder(String order) {
		this.order = order;
	}

	public String getDesc() {
		return desc;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}
	
}
